package com.logger.persistance.model;

import java.sql.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.JoinColumn;


@Entity
@Table(name = "log_file")
public class LogFile extends BaseObject {

    @Id
    @GeneratedValue
    @Column(name = "LogFile_id")
    private Integer logFileId;
    
    @Column(name = "LogFile_name")
    private String logFileName;
    
    @Column(name = "Date_creation")
    private Date dateCreation;
    
    @Column(name = "Conn_id")
    private Integer connId;
    
    @Column(name = "Session_id")
    private String sessionId;
    
    @ManyToOne
    @JoinColumn(name = "user_login" , referencedColumnName="user_login")
    private LogUser  logUser;
    
    @OneToMany (mappedBy ="logFile_id" , cascade = CascadeType.REMOVE)
    private List<LogQuery> logQuery;
    
    public Integer getLogFileId() {
        return logFileId;
    }

    public void setLogFileId(Integer logFileId) {
        this.logFileId = logFileId;
    }

    public String getLogFileName() {
        return logFileName;
    }

    public void setLogFileName(String logFileName) {
        this.logFileName = logFileName;
    }

    public Date getDateCreation() {
        return dateCreation;
    }

    public void setDateCreation(Date dateCreation) {
        this.dateCreation = dateCreation;
    }

    public Integer getConnId() {
        return connId;
    }

    public void setConnId(Integer connId) {
        this.connId = connId;
    }

    public String getSessionId() {
        return sessionId;
    }

    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }

   

    public LogUser getLogUser() {
        return logUser;
    }

    public void setLogUser(LogUser logUser) {
        this.logUser = logUser;
    }

    public String getNode() {
        return node;
    }

    public void setNode(String node) {
        this.node = node;
    }

    public LogFile(Integer logFileId, String logFileName, Date dateCreation, Integer connId, String sessionId, LogUser loguser, String node) {
        super();
        this.logFileId = logFileId;
        this.logFileName = logFileName;
        this.dateCreation = dateCreation;
        this.connId = connId;
        this.sessionId = sessionId;
        this.node = node;
        this.logUser = loguser ;
    }

    @Column(name = "Node")
    private String node;
    
    @Override
    public String toString() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public boolean equals(Object o) {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public int hashCode() {
        // TODO Auto-generated method stub
        return 0;
    }
    
    

}
